package Sort;

import java.util.Scanner;

/**
 * @author fly
 * @create 2021--03--16--10:01
 */
public class Acwing800 {
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int m=sc.nextInt();
        int x=sc.nextInt();
        int[] a=new int[n];
        int[] b=new int[m];
        for(int i=0;i<n;i++){
            a[i]=sc.nextInt();
        }
        for(int j=0;j<m;j++){
            b[j]=sc.nextInt();
        }
        for(int i=0,j=m-1;i<n;i++){
            while(j>=0&&a[i]+b[j]>x)j--;
            if(j>=0&&a[i]+b[j]==x) System.out.println(i+" "+j);
        }
    }
}
